
package cn.edu.scau.cmi.hombio.domain;

import java.io.Serializable;

import java.lang.StringBuilder;

import java.util.Calendar;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

import org.codehaus.jackson.annotate.JsonIgnore;

import javax.xml.bind.annotation.*;

import javax.persistence.*;

/**
 */

@Entity
@NamedQueries({
		@NamedQuery(name = "findAllEmployees", query = "select myEmployee from Employee myEmployee"),
		@NamedQuery(name = "findEmployeeByBirthday", query = "select myEmployee from Employee myEmployee where myEmployee.birthday = ?1"),
		@NamedQuery(name = "findEmployeeById", query = "select myEmployee from Employee myEmployee where myEmployee.id = ?1"),
		@NamedQuery(name = "findEmployeeByLogOn", query = "select myEmployee from Employee myEmployee where myEmployee.logOn = ?1"),
		@NamedQuery(name = "findEmployeeByMemo", query = "select myEmployee from Employee myEmployee where myEmployee.memo = ?1"),
		@NamedQuery(name = "findEmployeeByMemoContaining", query = "select myEmployee from Employee myEmployee where myEmployee.memo like ?1"),
		@NamedQuery(name = "findEmployeeByName", query = "select myEmployee from Employee myEmployee where myEmployee.name = ?1"),
		@NamedQuery(name = "findEmployeeByNameContaining", query = "select myEmployee from Employee myEmployee where myEmployee.name like ?1"),
		@NamedQuery(name = "findEmployeeByNumber", query = "select myEmployee from Employee myEmployee where myEmployee.number = ?1"),
		@NamedQuery(name = "findEmployeeByNumberContaining", query = "select myEmployee from Employee myEmployee where myEmployee.number like ?1"),
		@NamedQuery(name = "findEmployeeByPassword", query = "select myEmployee from Employee myEmployee where myEmployee.password = ?1"),
		@NamedQuery(name = "findEmployeeByPasswordContaining", query = "select myEmployee from Employee myEmployee where myEmployee.password like ?1"),
		@NamedQuery(name = "findEmployeeByPrimaryKey", query = "select myEmployee from Employee myEmployee where myEmployee.id = ?1"),
		@NamedQuery(name = "findEmployeeByRfid", query = "select myEmployee from Employee myEmployee where myEmployee.rfid = ?1"),
		@NamedQuery(name = "findEmployeeByRfidContaining", query = "select myEmployee from Employee myEmployee where myEmployee.rfid like ?1"),
		@NamedQuery(name = "findEmployeeBySex", query = "select myEmployee from Employee myEmployee where myEmployee.sex = ?1"),
		@NamedQuery(name = "findEmployeeBySexContaining", query = "select myEmployee from Employee myEmployee where myEmployee.sex like ?1"),
		@NamedQuery(name = "findEmployeeByState", query = "select myEmployee from Employee myEmployee where myEmployee.state = ?1") })

@Table(catalog = "pig", name = "employee")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain", name = "Employee")
@XmlRootElement(namespace = "pigRs/cn/edu/scau/cmi/hombio/domain")
public class Employee implements Serializable {
	private static final long serialVersionUID = 1L;

	/**
	 */

	@Column(name = "Id", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@Id @GeneratedValue
	@XmlElement
	Integer id;
	/**
	 */

	@Column(name = "Number", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String number;
	/**
	 */

	@Column(name = "Name", length = 8, nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String name;
	/**
	* Ա����¼����,Ĭ����123456,����sha512����
	* 
	 */

	@Column(name = "Password", length = 128, nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String password;
	/**
	* �жϸ�Ա�����޵�¼Ȩ�ޣ�Ĭ����
	* 
	 */

	@Column(name = "LogOn", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Boolean logOn;
	/**
	 */

	@Column(name = "RFID")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String rfid;
	/**
	* �Ա�
	* 
	 */

	@Column(name = "Sex", length = 2)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String sex;
	/**
	 */
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "Birthday")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Calendar birthday;
	/**
	* �ж�Ա���Ƿ��ǹ�˾��Ա����Ĭ����Ա��
	* 
	 */

	@Column(name = "State", nullable = false)
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	Boolean state;
	/**
	 */

	@Column(name = "Memo")
	@Basic(fetch = FetchType.EAGER)

	@XmlElement
	String memo;

	/**
	 */
	@OneToMany(mappedBy = "employeeByEmployeeId", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.FodderTake> fodderTakesForEmployeeId;
	/**
	 */
	@OneToMany(mappedBy = "employeeByEmployeeId", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.FodderTake> fodderTakesForWarehousekepperId;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.Sale> sales;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.MedicineStorage> medicineStorages;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.FodderStorage> fodderStorages;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.RoleEmployee> roleEmployees;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.ExceptionTypeEmployee> exceptionTypeEmployees;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.TaskEmployee> taskEmployees;
	/**
	 */
	@OneToMany(mappedBy = "employeeByPharmacistId", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.MedicineTake> medicineTakesForPharmacistId;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.TaskManage> taskManages;
	/**
	 */
	@OneToMany(mappedBy = "employeeByPharmacistId", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.MedicineTake> medicineTakesForTakerId;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.CurePig> curePigs;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.Inspection> inspections;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.Prevention> preventions;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.Task> tasks;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.Except> excepts;
	/**
	 */
	@OneToMany(mappedBy = "employee", cascade = { CascadeType.REMOVE }, fetch = FetchType.LAZY)

	
	java.util.Set<cn.edu.scau.cmi.hombio.domain.Feed> feeds;

	/**
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 */
	public Integer getId() {
		return this.id;
	}

	/**
	 */
	public void setNumber(String number) {
		this.number = number;
	}

	/**
	 */
	public String getNumber() {
		return this.number;
	}

	/**
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 */
	public String getName() {
		return this.name;
	}

	/**
	* Ա����¼����,Ĭ����123456,����sha512����
	* 
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	* Ա����¼����,Ĭ����123456,����sha512����
	* 
	 */
	public String getPassword() {
		return this.password;
	}

	/**
	* �жϸ�Ա�����޵�¼Ȩ�ޣ�Ĭ����
	* 
	 */
	public void setLogOn(Boolean logOn) {
		this.logOn = logOn;
	}

	/**
	* �жϸ�Ա�����޵�¼Ȩ�ޣ�Ĭ����
	* 
	 */
	public Boolean getLogOn() {
		return this.logOn;
	}

	/**
	 */
	public void setRfid(String rfid) {
		this.rfid = rfid;
	}

	/**
	 */
	public String getRfid() {
		return this.rfid;
	}

	/**
	* �Ա�
	* 
	 */
	public void setSex(String sex) {
		this.sex = sex;
	}

	/**
	* �Ա�
	* 
	 */
	public String getSex() {
		return this.sex;
	}

	/**
	 */
	public void setBirthday(Calendar birthday) {
		this.birthday = birthday;
	}

	/**
	 */
	public Calendar getBirthday() {
		return this.birthday;
	}

	/**
	* �ж�Ա���Ƿ��ǹ�˾��Ա����Ĭ����Ա��
	* 
	 */
	public void setState(Boolean state) {
		this.state = state;
	}

	/**
	* �ж�Ա���Ƿ��ǹ�˾��Ա����Ĭ����Ա��
	* 
	 */
	public Boolean getState() {
		return this.state;
	}

	/**
	 */
	public void setMemo(String memo) {
		this.memo = memo;
	}

	/**
	 */
	public String getMemo() {
		return this.memo;
	}

	/**
	 */
	public void setFodderTakesForEmployeeId(Set<FodderTake> fodderTakesForEmployeeId) {
		this.fodderTakesForEmployeeId = fodderTakesForEmployeeId;
	}

	/**
	 */
	@JsonIgnore
	public Set<FodderTake> getFodderTakesForEmployeeId() {
		if (fodderTakesForEmployeeId == null) {
			fodderTakesForEmployeeId = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.FodderTake>();
		}
		return fodderTakesForEmployeeId;
	}

	/**
	 */
	public void setFodderTakesForWarehousekepperId(Set<FodderTake> fodderTakesForWarehousekepperId) {
		this.fodderTakesForWarehousekepperId = fodderTakesForWarehousekepperId;
	}

	/**
	 */
	@JsonIgnore
	public Set<FodderTake> getFodderTakesForWarehousekepperId() {
		if (fodderTakesForWarehousekepperId == null) {
			fodderTakesForWarehousekepperId = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.FodderTake>();
		}
		return fodderTakesForWarehousekepperId;
	}

	/**
	 */
	public void setSales(Set<Sale> sales) {
		this.sales = sales;
	}

	/**
	 */
	@JsonIgnore
	public Set<Sale> getSales() {
		if (sales == null) {
			sales = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Sale>();
		}
		return sales;
	}

	/**
	 */
	public void setMedicineStorages(Set<MedicineStorage> medicineStorages) {
		this.medicineStorages = medicineStorages;
	}

	/**
	 */
	@JsonIgnore
	public Set<MedicineStorage> getMedicineStorages() {
		if (medicineStorages == null) {
			medicineStorages = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.MedicineStorage>();
		}
		return medicineStorages;
	}

	/**
	 */
	public void setFodderStorages(Set<FodderStorage> fodderStorages) {
		this.fodderStorages = fodderStorages;
	}

	/**
	 */
	@JsonIgnore
	public Set<FodderStorage> getFodderStorages() {
		if (fodderStorages == null) {
			fodderStorages = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.FodderStorage>();
		}
		return fodderStorages;
	}

	/**
	 */
	public void setRoleEmployees(Set<RoleEmployee> roleEmployees) {
		this.roleEmployees = roleEmployees;
	}

	/**
	 */
	@JsonIgnore
	public Set<RoleEmployee> getRoleEmployees() {
		if (roleEmployees == null) {
			roleEmployees = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.RoleEmployee>();
		}
		return roleEmployees;
	}

	/**
	 */
	public void setExceptionTypeEmployees(Set<ExceptionTypeEmployee> exceptionTypeEmployees) {
		this.exceptionTypeEmployees = exceptionTypeEmployees;
	}

	/**
	 */
	@JsonIgnore
	public Set<ExceptionTypeEmployee> getExceptionTypeEmployees() {
		if (exceptionTypeEmployees == null) {
			exceptionTypeEmployees = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.ExceptionTypeEmployee>();
		}
		return exceptionTypeEmployees;
	}

	/**
	 */
	public void setTaskEmployees(Set<TaskEmployee> taskEmployees) {
		this.taskEmployees = taskEmployees;
	}

	/**
	 */
	@JsonIgnore
	public Set<TaskEmployee> getTaskEmployees() {
		if (taskEmployees == null) {
			taskEmployees = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.TaskEmployee>();
		}
		return taskEmployees;
	}

	/**
	 */
	public void setMedicineTakesForPharmacistId(Set<MedicineTake> medicineTakesForPharmacistId) {
		this.medicineTakesForPharmacistId = medicineTakesForPharmacistId;
	}

	/**
	 */
	@JsonIgnore
	public Set<MedicineTake> getMedicineTakesForPharmacistId() {
		if (medicineTakesForPharmacistId == null) {
			medicineTakesForPharmacistId = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.MedicineTake>();
		}
		return medicineTakesForPharmacistId;
	}

	/**
	 */
	public void setTaskManages(Set<TaskManage> taskManages) {
		this.taskManages = taskManages;
	}

	/**
	 */
	@JsonIgnore
	public Set<TaskManage> getTaskManages() {
		if (taskManages == null) {
			taskManages = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.TaskManage>();
		}
		return taskManages;
	}

	/**
	 */
	public void setMedicineTakesForTakerId(Set<MedicineTake> medicineTakesForTakerId) {
		this.medicineTakesForTakerId = medicineTakesForTakerId;
	}

	/**
	 */
	@JsonIgnore
	public Set<MedicineTake> getMedicineTakesForTakerId() {
		if (medicineTakesForTakerId == null) {
			medicineTakesForTakerId = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.MedicineTake>();
		}
		return medicineTakesForTakerId;
	}

	/**
	 */
	public void setCurePigs(Set<CurePig> curePigs) {
		this.curePigs = curePigs;
	}

	/**
	 */
	@JsonIgnore
	public Set<CurePig> getCurePigs() {
		if (curePigs == null) {
			curePigs = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CurePig>();
		}
		return curePigs;
	}

	/**
	 */
	public void setInspections(Set<Inspection> inspections) {
		this.inspections = inspections;
	}

	/**
	 */
	@JsonIgnore
	public Set<Inspection> getInspections() {
		if (inspections == null) {
			inspections = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Inspection>();
		}
		return inspections;
	}

	/**
	 */
	public void setPreventions(Set<Prevention> preventions) {
		this.preventions = preventions;
	}

	/**
	 */
	@JsonIgnore
	public Set<Prevention> getPreventions() {
		if (preventions == null) {
			preventions = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Prevention>();
		}
		return preventions;
	}

	/**
	 */
	public void setTasks(Set<Task> tasks) {
		this.tasks = tasks;
	}

	/**
	 */
	@JsonIgnore
	public Set<Task> getTasks() {
		if (tasks == null) {
			tasks = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Task>();
		}
		return tasks;
	}

	/**
	 */
	public void setExcepts(Set<Except> excepts) {
		this.excepts = excepts;
	}

	/**
	 */
	@JsonIgnore
	public Set<Except> getExcepts() {
		if (excepts == null) {
			excepts = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Except>();
		}
		return excepts;
	}

	/**
	 */
	public void setFeeds(Set<Feed> feeds) {
		this.feeds = feeds;
	}

	/**
	 */
	@JsonIgnore
	public Set<Feed> getFeeds() {
		if (feeds == null) {
			feeds = new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Feed>();
		}
		return feeds;
	}

	/**
	 */
	public Employee() {
	}

	/**
	 * Copies the contents of the specified bean into this bean.
	 *
	 */
	public void copy(Employee that) {
		setId(that.getId());
		setNumber(that.getNumber());
		setName(that.getName());
		setPassword(that.getPassword());
		setLogOn(that.getLogOn());
		setRfid(that.getRfid());
		setSex(that.getSex());
		setBirthday(that.getBirthday());
		setState(that.getState());
		setMemo(that.getMemo());
		setFodderTakesForEmployeeId(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.FodderTake>(that.getFodderTakesForEmployeeId()));
		setFodderTakesForWarehousekepperId(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.FodderTake>(that.getFodderTakesForWarehousekepperId()));
		setSales(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Sale>(that.getSales()));
		setMedicineStorages(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.MedicineStorage>(that.getMedicineStorages()));
		setFodderStorages(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.FodderStorage>(that.getFodderStorages()));
		setRoleEmployees(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.RoleEmployee>(that.getRoleEmployees()));
		setExceptionTypeEmployees(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.ExceptionTypeEmployee>(that.getExceptionTypeEmployees()));
		setTaskEmployees(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.TaskEmployee>(that.getTaskEmployees()));
		setMedicineTakesForPharmacistId(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.MedicineTake>(that.getMedicineTakesForPharmacistId()));
		setTaskManages(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.TaskManage>(that.getTaskManages()));
		setMedicineTakesForTakerId(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.MedicineTake>(that.getMedicineTakesForTakerId()));
		setCurePigs(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.CurePig>(that.getCurePigs()));
		setInspections(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Inspection>(that.getInspections()));
		setPreventions(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Prevention>(that.getPreventions()));
		setTasks(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Task>(that.getTasks()));
		setExcepts(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Except>(that.getExcepts()));
		setFeeds(new java.util.LinkedHashSet<cn.edu.scau.cmi.hombio.domain.Feed>(that.getFeeds()));
	}

	/**
	 * Returns a textual representation of a bean.
	 *
	 */
	public String toString() {

		StringBuilder buffer = new StringBuilder();

		buffer.append("id=[").append(id).append("] ");
		buffer.append("number=[").append(number).append("] ");
		buffer.append("name=[").append(name).append("] ");
		buffer.append("password=[").append(password).append("] ");
		buffer.append("logOn=[").append(logOn).append("] ");
		buffer.append("rfid=[").append(rfid).append("] ");
		buffer.append("sex=[").append(sex).append("] ");
		buffer.append("birthday=[").append(birthday).append("] ");
		buffer.append("state=[").append(state).append("] ");
		buffer.append("memo=[").append(memo).append("] ");

		return buffer.toString();
	}

	/**
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = (int) (prime * result + ((id == null) ? 0 : id.hashCode()));
		return result;
	}

	/**
	 */
	public boolean equals(Object obj) {
		if (obj == this)
			return true;
		if (!(obj instanceof Employee))
			return false;
		Employee equalCheck = (Employee) obj;
		if ((id == null && equalCheck.id != null) || (id != null && equalCheck.id == null))
			return false;
		if (id != null && !id.equals(equalCheck.id))
			return false;
		return true;
	}
}
